home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8525 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: cedarnet.cedarville.edu!usenet
  2. From: Tim Hansell <hansellt@cedarville.edu>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: macro that return value, how?
  5. Date: Mon, 04 Mar 1996 15:29:45 -0800
  6. Organization: Cedarville College
  7. Message-ID: <313B7CE9.4876@cedarville.edu>
  8. References: <3133e87b.868433@news.csus.edu> <3136FA60.350B@cmt.lpr.mail.carel.fi> <TANMOY.96Mar1091759@qcd.lanl.gov>
  9. NNTP-Posting-Host: hansellt2.cedarville.edu
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (Win16; I)
  14.  
  15. Tanmoy Bhattacharya wrote:
  16. > Ari Lukumies <aril@cmt.lpr.mail.carel.fi> writes:
  17. > <snip>
  18. AL: This will compile:
  19. AL:
  20. AL:     #define add1(x) (x += VAR)
  21. AL:
  22. AL: Remember, the result of an assignment is implicitly returned. So,
  23. you can use
  24. AL: constructs like:
  25. <snip>
  26. AL: and
  27. AL:     if (add1(2) == 2)
  28. AL:             DoSomething...
  29.  
  30. I could not get this snippet to compile with Borland C 4.5
  31.  
  32. It complaines on any statment using "add1(2)" that
  33. the "LVALUE" is incorrect.
  34.  
  35. Which I take to mean that the resulting statement..
  36.  
  37. "2 += 2 ;"
  38.  
  39. doesn't have a variable on the left hand side of the assignment...
  40. so it won't compile ...
  41.  
  42. What compiler did you use ?
  43.  
  44. -tim
  45.